﻿#region Copyright Notices
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Library General Public License for more details.
// 
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Yarr.YarrPad
{
    /// <summary>
    /// Interaction logic for InputDlg.xaml
    /// </summary>
    public partial class InputDlg : Window
    {
        private string inputText;

        public string InputText { get { return inputText; } }


        public InputDlg()
        {
            InitializeComponent();
        }

        public InputDlg(string windowTitle, string labelText)
        {
            InitializeComponent();

            this.Title = windowTitle;
            this.labelPrompt.Content = labelText;
        }

        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            inputText = inputBox.Text.Trim();
            this.DialogResult = !String.IsNullOrEmpty(inputText);

            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.inputBox.Focus();
        }
    }
}
